package com.callbell.cas.context;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * 校验码信息上下文对象
 * 保存用户尝试登录的次数
 * 
 * key：用户名
 * value：登录失败的次数
 * @author YangJian
 *
 */
public class CaptchaContext {
	
	/**用来保存key:userName value:登录失败的次数*/
	private static ConcurrentMap<String, Integer> context=new ConcurrentHashMap<String, Integer>();
	
	public static void setAttemptLoginCount(String userName,Integer attemptLoginCount){
		context.put(userName, attemptLoginCount);
	}
	
	public static Integer getAttemptLoginCount(String userName){
		return context.get(userName);
	}
	
	public static void remove(String userName){
		context.remove(userName);
	}
	
	public static void clear(){
		context.clear();
	}
}
